ioemu: Initialize ioport_opaque, ioport_read/write_table to zero
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 20 Mar 2008 10:46:52 +0000 (10:46 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 20 Mar 2008 10:46:52 +0000 (10:46 +0000)
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
tools/ioemu/vl.c

index 7a717f53bff270000bcafc9c31d89bcc0bd7efc2..1cbe3a99e4672f6112a688bc9a8955577e519365 100644 (file)
@@ -281,9 +281,9 @@ void default_ioport_writel(void *opaque, uint32_t address, uint32_t data)
 
 void init_ioports(void)
 {
-    ioport_opaque = malloc(MAX_IOPORTS * sizeof(*ioport_opaque));
-    ioport_read_table = malloc(3 * MAX_IOPORTS * sizeof(**ioport_read_table));
-    ioport_write_table = malloc(3 * MAX_IOPORTS * sizeof(**ioport_write_table));
+    ioport_opaque = calloc(MAX_IOPORTS, sizeof(*ioport_opaque));
+    ioport_read_table = calloc(3 * MAX_IOPORTS, sizeof(**ioport_read_table));
+    ioport_write_table = calloc(3 * MAX_IOPORTS, sizeof(**ioport_write_table));
 }
 
 /* size is the word size in byte */